<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>所有相片</title>
<script type="text/javascript" src="Public/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="Public/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="Public/js/lazyload.js"></script>
<script type="text/javascript" src="Public/artDialog/artDialog.source.js?skin=default" charset="utf-8"></script>
<script type="text/javascript" src="Public/js/jquery.ae.image.resize.min.js"></script>
<link rel="stylesheet" href="Public/bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="theme/default/css/common.css">
<link rel="stylesheet" href="Public/css/homeindex.css">

  <!--[if lte IE 6]>
  <link rel="stylesheet" type="text/css" href="Public/bootstrap/css/bootstrap-ie6.css">
  <![endif]-->
  <!--[if lte IE 7]>
  <link rel="stylesheet" type="text/css" href="Public/bootstrap/css/ie.css">
  <![endif]-->


  
  <script type="text/javascript">
function postPhotoForm(){
	$.ajax({
	url:'index.php?s=/Home/Albums/doPhotoSave',
	type:'POST',
	data:$('#photo-info-form').serialize(),
	dataType:'text',
	success:function(json){
		art.dialog({id: 'peditDialog'}).close();
	}
	});	
}
  var dialog;
function PhotoEditDialog(id){
	dialog = art.dialog({
		id:"peditDialog",
		title:"编辑相片",
		width: 722,
    	height: 452,
		lock:true,
		button:{
			name:'关闭'	
		}
	});
	$.ajax({
		url: 'index.php?s=/Home/Albums/PhotoEdit/id/'+id,
		success: function (data) {
			dialog.content(data);
		},
		cache: false
	});
}

var dialog_label;
function labelDialog(fname,fid,id,photo_id){
	dialog_label = art.dialog({
		id:fid,
		title:fname,
		drag:true,
    	follow: document.getElementById(id),
		button:{
			name:'关闭'	
		}
	});
	// jQuery ajax   
	$.ajax({
		url: 'index.php?s=/Home/Label/index/fid/'+fid+'/id/'+id+'/photo_id/'+photo_id,
		success: function (data) {
			dialog_label.content(data);
			$(".labelText").click(function(){
					labelAdd("#label_"+fid,$(this).attr("id"),$(this).text(),photo_id);
});	
		},
		cache: false
	});

				
}
function labelAdd(obj,id,t,photo_id){
	//Dom id, 序,标签名称
	$(obj).append('<span class="label label-info">'+t+'<input type="hidden" name="photo_label['+photo_id+'][]" value="'+id+'"><a href="javascript:void(0)" class="close" data-dismiss="alert">&times;</a></span>');
		
}
function reloadLabel(fid,photo_id){
	$.ajax({
		url: 'index.php?s=/Home/Label/index/fid/'+fid+'/id/label_'+fid+'/photo_id/'+photo_id,
		success: function (data) {
			art.dialog.list[fid].content(data);
			$(".labelText").click(function(){
					labelAdd("#label_"+fid,$(this).attr("id"),$(this).text(),photo_id);
});	
		},
		cache: false
	});	
}
function postLabel(fid,photo_id){
	
	var labelName = '';
	labelName = $("#newLabel_"+fid).val();
	if($.trim(labelName)!=''){
		$.ajax(
		{
			type: "POST",
                    url: 'index.php?s=/Home/Label/doAdd/',
                    data: "newLabel="+labelName,
                    dataType: "text",
                    success:function(resp){
						
						
	$.ajax({
		url: 'index.php?s=/Home/Label/index/fid/'+fid+'/id/label_'+fid+'/photo_id/'+photo_id,
		success: function (data) {
			art.dialog.list[fid].content(data);
			$(".labelText").click(function(){
					labelAdd("#label_"+fid,$(this).attr("id"),$(this).text(),photo_id);
});	
		},
		cache: false
	});
	
	
	
	
					}
		}
		);	
	}
}

$(document).ready(function(){
	$(".photo_edit").click(function(){
		PhotoEditDialog($(this).attr("id"));
	});
});
  </script>
</head>

<body>

<include file="./template/default/Public/header-logined.html" />

    <div class="container main">
      <div class="row-fluid">
        <div class="span3">
          <include file="./template/default/Public/sidebar.html" />
        </div><!--/span-->
        <div class="content span9">
          
          <div class="well">
            <ul class="nav nav-tabs" id="fb_info_nav">
<?php
$i_=0;
?>
  <volist name="result" id="rs">
  <?php
  if(empty($rs['baby_realname'])){
  	$realname=$rs['baby_nickname'];
  }else{
  	$realname = $rs['baby_realname'];
  }

  if($i_==0){
  ?>
  <li class="active"><a href="#baby_<?php echo $i_;?>" data-toggle="tab" class="tab_link">{$realname}</a></li>
  <?php
  }else{
  ?>
  <li><a href="#baby_<?php echo $i_;?>" data-toggle="tab" class="tab_link">{$realname}</a></li>
  <?php
  }
  $i_++;
  ?>
  </volist>
</ul>          
          	<div class="page-header"><h3>所有相片</h3></div>

<div>年:
<ul class="nav nav-pills">
<?php
$baby_bornyear = date("Y",$current_baby['baby_borndate']);
$current_year = date("Y",time());
$current_year_i = $current_year;
$year_i=0;
for(;$current_year_i>=$baby_bornyear;$current_year_i--){

if(!isset($_GET['Year'])){
	if($current_year_i==$current_year){
			echo '<li class="active"><a href="index.php?s=/Home/Albums/Photo/Year/'.$current_year_i.'/Month/">'.$current_year_i.'</a></li>';
    }else{
        	 echo '<li><a href="index.php?s=/Home/Albums/Photo/Year/'.$current_year_i.'/Month/">'.$current_year_i.'</a></li>';
    }
}else{

if($current_year_i==$_GET['Year']){
			echo '<li class="active"><a href="index.php?s=/Home/Albums/Photo/Year/'.$current_year_i.'/Month/">'.$current_year_i.'</a></li>';
    }else{
        	 echo '<li><a href="index.php?s=/Home/Albums/Photo/Year/'.$current_year_i.'/Month/">'.$current_year_i.'</a></li>';
    }

}
    
}
?>
</ul>

<br></div>

<div>月:
<ul class="breadcrumb">
<?php
$m=date("m",time());
for($i=1;$i<=12;$i++){


    
if(isset($_GET['Year'])){
//如果有传递年参数过来
	if($_GET['Month']==$i){
		echo '<li class="active">'.$i.' <span class="divider">/</span></li>';
    }else{
		echo '<li><a href="index.php?s=/Home/Albums/Photo/Year/'.$_GET['Year'].'/Month/'.$i.'">'.$i.'</a> <span class="divider">/</span></li>';    	
    }
}else{
	if($i==$m){
		echo '<li><a href="index.php?s=/Home/Albums/Photo/Year/'.$current_year.'/Month/'.$i.'">'.$i.'</a> <span class="divider">/</span></li>';
    }else{
		echo '<li><a href="index.php?s=/Home/Albums/Photo/Year/'.$current_year.'/Month/'.$i.'">'.$i.'</a> <span class="divider">/</span></li>';
    	
    }

}

}
?>
</ul>
</div>


            <table class="table">
            <thead>
            	<tr>
                	<th>拍摄时间</th>
                    <th>相片预览</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
            <volist name="photoList" id="rs">
            
            <tr>
            	<td>
                <?php
                echo date("Y-m-d H:i:s",$rs['photo_createdate']);
                ?>
                </td>
            <td>
            <img src="http://facesbaby.u.qiniudn.com/{$rs['photo_path']}?imageView/1/w/64/h/64">
            </td>
            <td>
            <a href="javascript:void(0)" class="button photo_edit" id="{$rs['id']}">编辑</a>
            </td>
            </tr>
            
            
            </volist>
            </tbody>
            </table>
            <div class="pagination">
            	{$show}
            </div>
          </div><!--end well-->
         
        </div><!--/span-->
      </div><!--/row-->
      
      </div>


<include file="./template/default/Public/footer-logined.html" />


</body>
</html>